﻿using array_demo.Model.Tree;

namespace array_demo.Model.Dictionary
{
    public class Bst1Dictionary<Key, Value> : IDictionary<Key, Value> where Key : IComparable
    {
        private Bst2<Key, Value> bst2;

        public Bst1Dictionary()
        {
            bst2 = new Bst2<Key, Value>();
        }

        public bool IsEmpty
        {
            get { return bst2.IsEmpty; }
        }

        public int Count
        {
            get { return bst2.Count; }
        }

        public void Add(Key key, Value value)
        {
            bst2.AddV1(key, value);
        }

        public bool contains(Key key)
        {
            return bst2.Contains(key);
        }

        public Value Get(Key key)
        {
            return bst2.Get(key);
        }

        public void Remove(Key key)
        {
            bst2.Del(key);
        }

        public void Set(Key key, Value value)
        {
            bst2.AddV1(key, value);
        }
    }
}